﻿using MyUtils.Core;
using PWMIS.DataProvider.Data;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyUtils.Module
{
    public partial class ClassCreate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            btnCreate.Click += btnCreate_Click;
        }

        void btnCreate_Click(object sender, EventArgs e)
        {
            AdoHelper db = DBContext.GetDB(tbServer.Text);
            DataTable dt = db.ExecuteDataSet(tbSql.Text).Tables[0];
            if (string.IsNullOrEmpty(tbClassname.Text)) tbClassname.Text = "LeiMing";
            string rts = ClassGenerateHelper.DataTableToClass(dt, tbClassname.Text);
            tbResult.Text = rts;
        }
    }
}